package com.gitee.passerr.leetcode.problem.algorithm.page1

import spock.lang.Specification
import spock.lang.Unroll

/**
 * {@link Solution39}测试用例
 * @Copyright (c)tellyes tech. inc. co.,ltd
 * @date 2019/07/09 10:41
 * @author xiehai
 */
class Solution39Spec extends Specification {
    Solution39 solution39 = new Solution39()

    @Unroll
    def "combinationSum(#nums, #target) = #result"() {
        expect:
        result == this.solution39.combinationSum(nums, target)

        where:
        nums                  | target || result
        [2, 3, 6, 7] as int[] | 7      || [[2, 2, 3], [7]]
        [2, 3, 5] as int[]    | 8      || [[2, 3, 3], [2, 2, 2, 2], [3, 5]]
        [
            92, 71, 89, 74, 102, 91, 70, 119, 86,
            116, 114, 106, 80, 81, 115, 99, 117,
            93, 76, 77, 111, 110, 75, 104, 95, 112, 94, 73
        ] as int[]            | 310    || [
            [92, 106, 112],
            [94, 106, 110],
            [73, 74, 74, 89],
            [89, 104, 117],
            [91, 104, 115],
            [95, 104, 111],
            [70, 73, 81, 86],
            [92, 102, 116],
            [94, 102, 114],
            [102, 102, 106],
            [76, 115, 119],
            [80, 115, 115],
            [70, 70, 71, 99],
            [76, 76, 77, 81],
            [73, 77, 80, 80],
            [70, 73, 73, 94],
            [80, 111, 119],
            [70, 74, 75, 91],
            [71, 71, 74, 94],
            [71, 73, 74, 92],
            [70, 70, 75, 95],
            [73, 75, 76, 86],
            [70, 77, 77, 86],
            [71, 74, 76, 89],
            [70, 71, 77, 92],
            [71, 71, 77, 91],
            [71, 73, 77, 89],
            [70, 71, 80, 89],
            [71, 77, 81, 81],
            [92, 99, 119],
            [94, 99, 117],
            [77, 114, 119],
            [81, 114, 115],
            [74, 75, 80, 81],
            [86, 112, 112],
            [75, 77, 77, 81],
            [70, 74, 74, 92],
            [71, 71, 73, 95],
            [71, 73, 73, 93],
            [81, 110, 119],
            [89, 110, 111],
            [73, 74, 77, 86],
            [70, 73, 76, 91],
            [70, 75, 76, 89],
            [70, 71, 76, 93],
            [73, 73, 75, 89],
            [89, 106, 115],
            [93, 106, 111],
            [92, 104, 114],
            [94, 104, 112],
            [71, 73, 80, 86],
            [70, 70, 81, 89],
            [102, 104, 104],
            [89, 102, 119],
            [91, 102, 117],
            [93, 102, 115],
            [74, 117, 119],
            [76, 117, 117],
            [75, 75, 80, 80],
            [74, 74, 81, 81],
            [76, 77, 77, 80],
            [73, 76, 80, 81],
            [70, 73, 75, 92],
            [71, 74, 74, 91],
            [70, 71, 75, 94],
            [74, 75, 75, 86],
            [70, 74, 77, 89],
            [71, 71, 76, 92],
            [70, 70, 77, 93],
            [71, 76, 77, 86],
            [73, 73, 73, 91],
            [70, 74, 80, 86],
            [70, 80, 80, 80],
            [75, 116, 119],
            [77, 116, 117],
            [95, 99, 116],
            [99, 99, 112],
            [80, 114, 116],
            [73, 75, 81, 81],
            [74, 76, 80, 80],
            [81, 112, 117],
            [70, 73, 74, 93],
            [86, 110, 114],
            [70, 71, 74, 95],
            [74, 74, 76, 86],
            [71, 71, 75, 93],
            [71, 73, 75, 91],
            [71, 75, 75, 89],
            [70, 70, 76, 94]
        ]
    }
}
